//
//  DFSong.m
//  doubanFun
//
//  Created by bing on 16/3/22.
//  Copyright © 2016年 bing. All rights reserved.
//  歌曲对象

#import "DFSong.h"

@implementation DFSong

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    if (self = [super init]) {
        _sid         = [dictionary stringForKey:@"sid"];
        _title       = [dictionary stringForKey:@"title"];
        _aid         = [dictionary stringForKey:@"aid"];
        _albumtitle  = [dictionary stringForKey:@"albumtitle"];
        _picture     = [dictionary stringForKey:@"picture"];
        _album       = [dictionary stringForKey:@"album"];
        _artist      = [dictionary stringForKey:@"artist"];
        _url         = [dictionary stringForKey:@"url"];
        _file_ext    = [dictionary stringForKey:@"file_ext"];
        _company     = [dictionary stringForKey:@"company"];
        _length      = [dictionary numberForKey:@"length"];
        _public_time = [dictionary stringForKey:@"public_time"];
        _kbps        = [dictionary stringForKey:@"kbps"];
        _like        = [dictionary numberForKey:@"like"];
        _ssid        = [dictionary stringForKey:@"ssid"];
        _subtype     = [dictionary stringForKey:@"subtype"];
        _status      = [dictionary numberForKey:@"status"];
        _sha256      = [dictionary stringForKey:@"sha256"];
        NSDictionary *data = [dictionary arrayForKey:@"singers"].firstObject;
        _singers = [DFSingers initWithDictionary:data];
    }
    return self;
}

+ (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    return [[self alloc] initWithDictionary:dictionary];
}

@end